/*
 *  This file is part of LifeBudget - Copyright 2010 Clifton Eaton
 *  ------------------------------------------------------------------
 *  LifeBudget is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  LifeBudget is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with LifeBudget.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.lifebudget.app.client.mvc.controller;

import org.lifebudget.app.client.events.AppEvents;
import org.lifebudget.app.client.mvc.view.TabView;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;

/**
 * Simple controller for handling the events handled by the {@link TabView}.
 */
public class TabController extends Controller {
	
	/** The tab view. */
	private TabView tabView;

	/**
	 * Instantiates a new tab controller.
	 */
	public TabController() {
		registerEventTypes(AppEvents.Init);
	}
	  
  	/* (non-Javadoc)
  	 * @see com.extjs.gxt.ui.client.mvc.Controller#initialize()
  	 */
  	public void initialize() {
		    tabView = new TabView(this);
	}
	
	/* (non-Javadoc)
	 * @see com.extjs.gxt.ui.client.mvc.Controller#handleEvent(com.extjs.gxt.ui.client.mvc.AppEvent)
	 */
	@Override
	public void handleEvent(AppEvent event) {
		if(event.getType() == AppEvents.Init){
			//GWT.log("TabController received AppEvent Init, forwarding to view");
			forwardToView(tabView, event);
		}
	}
	

}
